/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package vm.help;

import javax.swing.table.AbstractTableModel;

/**
 *
 * @author Peer
 */
public class HelpTableModelSHVM extends AbstractTableModel {

    Object[][] data = {{"' '","Do Nothing"},
                       {"%","Begin execution here"},
                       {"p","Print S0 interpreted as an integer"},
                       {"P","Print S0 interpreted as an ASCII character"},
                       {"0..9","Push 0..9 on the Stack"},
                       {"+","Push S1 + S0"},
                       {"-","Push S1 - S0"},
                       {"*","Push S1 * S0"},
                       {"d","Push S1 / S0"},
                       {",","Read one value from input"},
                       {"s","Skip one instruction"},
                       {"\\","Change diretion: left -> up; up -> left; right -> down; down -> right"},
                       {"/","Change diretion: left -> down; down -> left; right -> up; up -> right"},
                       {":","If S0 > S1, turn left. If S0 < S1, turn right."},
                       {"?","Skip one instruction if S0 is 0"},
                       {"@","Push the current direction and PC location on the call-stack"},
                       {"$","Pop direction and PC location off call-stack and advance PC one step"},
                       {"[","Move memory pointer to the left by S0 places"},
                       {"]","Move memory pointer to the right by S0 places"},
                       {"{","Move memory pointer up one place"},
                       {"}","Move memory pointer down one place"},
                       {"x","Push a copy of S0"},
                       {"<","Push the value of memory cell (S0, S1)"},
                       {">","Store S2 into (S0, S1)"},
                       {"^","Push a copy of S<S0+1> (ex: 0^ duplicates S0)"},
                       {"v","Remove S<S0+1> from the stack and push it on top (ex: 1v swaps S0 and S1)"},
                       {"g","Get code value at (S0, S1)"},
                       {"w","Write code value at (S0, S1)"},
                       {"&","Create new thread, advance current thread one step. New threads inherit the program counter and memory pointer of the parent, but have an empty call stack."},
                       {"!","Terminate the program"}};
    String[] header = {"Cmd","Description"};

    @Override
    public String getColumnName(int column) {
        return header[column];
    }

    public int getRowCount() {
        return data.length;
    }

    public int getColumnCount() {
        return header.length;
    }

    public Object getValueAt(int rowIndex, int columnIndex) {
        return data[rowIndex][columnIndex];
    }
    
}
